<template>
  <div>
    <!-- input -->
    <!-- 增删改查 -->
    <el-input v-model="msg" prefix-icon="el-icon-user-solid" />
    <el-button type="primary" class="btn">主要按钮</el-button>
    <!-- 表单
    基本表单验证
       1：表单元素值的绑定
       2:el-form
            model:整个表单元素的值
            rules:表单验证的规则，它是一个对象
         el-form-item
            prop:表单元素值的字段名
      3：rules：{
        prop的值:[
           {required:true,message:'错误信息',trigger:'blur/change'},
           {pattern:正则,message:'错误信息',trigger:'blur/change'},
           {min:最小长度,max:最大长度,message:'错误信息',trigger:'blur/change'}
        ]
      }

    -->
    <el-form label-width="100px" :model="form" :rules="rules">
      <el-form-item label="姓名" prop="username">
        <el-input v-model="form.username" />
      </el-form-item>
      <el-form-item label="新密码" prop="password">
        <el-input v-model="form.password" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary">更新</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  data() {
    return {
      msg: 'hello',
      form: {
        username: '',
        password: ''
      },
      rules: {
        username: [
          { required: true, message: '必填', trigger: 'change' },
          { min: 2, max: 16, message: '请输入2-16位姓名', trigger: 'change' }
        ],
        password: [
          { required: true, message: '必填', trigger: 'change' },
          {
            pattern: /^\w{6,16}$/,
            message: '请输入6-16位密码',
            trigger: 'change'
          }
        ]
      }
    }
  }
}
</script>
<style lang="scss" scoped>
// ::v-deep .el-input__inner {
//   height: 80px;
// }
.btn {
  width: 600px;
  height: 120px;
  font-size: 30px;
}
</style>
